package com.sl.au.service;

import com.sl.au.entity.*;
import com.sl.au.repository.*;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 应收账管理服务
 * Created by RX on 2016/11/22.
 */
public interface PaymentInitialService extends BaseService{
    PaymentInitialRepository getRepository();
    PayRegistRepository getPayRegistRepository();
    PaymentPlanRepository getPaymentPlanRepository();
    PayPlanRepository getPayPlanRepository();
    PaymentRegistRepository getPaymentRegistRepository();

    /**
     * 得到合同对应应收账计划
     * @param contractId
     * @param contractType
     * @return
     */
    List<PaymentInitial> getPaymentSchedule(String contractId,String contractType);

    /**
     * 获取合同对应回款历史
     *
     * @param id
     * @param contractId
     * @param contractType
     * @return
     */
    List<PayRegist> getPayHistory(int start, int length, String id, String contractId, String contractType, String userId, String orderName);
    /**
     * 获取合同对应回款历史数据条数
     * @param contractId
     * @return
     */
    Long getPayRegistCount(String contractId,String userId);
    /**
     * 获取合同对应开票历史
     * @param contractId
     * @param contractType
     * @return
     */
    List<PaymentRegist> getPaymentHistory(int start, int length,String contractId, String contractType,String userId,String orderName ,String dir);
    /**
     * 获取合同对应开票历史数据条数
     * @param contractId
     * @return
     */
    Long getPaymentRegistCount(String contractId,String userId);
    /**
     *获取回款-计划表数据
     * @param contractId
     * @param contractType
     * @return
     */
    List<PayPlan> getPayPlan(int start, int length,String contractId, String contractType,String orderName ,String dir);
    /**
     *获取回款-计划表数据条数
     * @param contractId
     * @return
     */
    Long getPayPlanCount(String contractId);
    /**
     *获取开票-计划表数据
     * @param contractId
     * @param contractType
     * @return
     */
    List<PaymentPlan> getPaymentPlan(int start, int length,String contractId, String contractType,String orderName ,String dir);
    /**
     *获取开票-计划表数据条数
     * @param contractId
     * @return
     */
    Long getPaymentPlanCount(String contractId);

    /**
     * 新增保存回款
     * @param payRegist
     */
    void savePayRegist(PayRegist payRegist);
    /**
     * 保存开票
     * @param paymentRegist
     */
    void savePaymentRegist(PaymentRegist paymentRegist);

    /**
     * 保存回款-计划
     * @param fund
     * @param scheduleSum
     * @param paidStage
     * @param scheduleDate
     */
    void savePayPlan(String fund,String planId, float scheduleSum, float paidStage, Date scheduleDate,PayRegist payRegist);
    /**
     * 保存开票-计划
     * @param fund
     * @param scheduleSum
     * @param paymentStage
     * @param scheduleDate
     */
    void savePaymentPlan(String fund,String planId, float scheduleSum, float paymentStage, Date scheduleDate, PaymentRegist paymentRegist);

    /**
     * 初始化计划
     * @param contractId
     * @param contractType
     */
    void getPaySchedule(String contractId, String contractType);

    /**
     *保存未抵消回款金额的款项
     * @param contractId
     */
    void saveNotPayPlan(List<PayPlan> newPayPlan1,String[] fund, String contractId,Date[] scheduleDate,float[] scheduleSum);

    /**
     * 获取当前回款阶段信息
     * @param newPayPlan
     */
    List<Object> getNewPayPlan(List<PayPlan> newPayPlan);
    /**
     *保存未抵消开票金额的款项
     * @param contractId
     */
    void saveNotPaymentPlan(List<PaymentPlan> newPaymentPlan1, String[] fund, String contractId, Date[] scheduleDate, float[] scheduleSum);

    /**
     * 生成回款对应计划表
     * @return
     */
    Map<String,Object> setPayPlan(PayRegist payRegist);

    /**
     * 更新回款对应计划表数据
     * @return
     */
    Map<String,Object> updataPayPlan(PayRegist payRgist,PayRegist payRgist1,float paidSum,Date paidDateOld);

    /**
     * 生成开票计划对应表
     * @return
     */
    Map<String,Object> setPaymentPlan(PaymentRegist paymentRegist);

    /**
     * 更新开票计划对应表
     * @return
     */
    Map<String,Object> updataPaymentPlan(PaymentRegist paymentRegist,PaymentRegist paymentRegist1,float paymentSum);

    /**
     * 删除回款后更新回款计划对应表
     * @param minDate
     * @param contractId
     */
    Map<String,Object> refreshPayPlan(Date firstDate,Date secondDate, String contractId,String contractType);
    /**
     * 删除开票后更新开票计划对应表
     * @param minDate
     * @param contractId
     */
    Map<String,Object> refreshPaymentPlan(Date firstDate,Date secondDate, String contractId, String contractType);

    /**
     * 开票历史数据-财务人员
     * @param start
     * @param length
     * @param contractId
     * @param contractType
     * @param o
     * @param o1
     * @return
     */
    List<PaymentRegist> getPaymentAllHistory(int start, int length, String contractId, String contractType, Object o, Object o1);

    /**
     * 开票数据条数-财务
     * @param contractId
     * @return
     */
    Long getPaymentAllRegistCount(String contractId);

    /**
     * 回款历史数据-财务
     * @param start
     * @param length
     * @param contractId
     * @param contractType
     * @param o
     * @param o1
     * @return
     */
    List<PayRegist> getPayAllHistory(int start, int length, String contractId, String contractType, Object o, Object o1);

    /**
     * 回款历史条数-财务
     * @param contractId
     * @return
     */
    Long getPayAllRegistCount(String contractId);

    /**
     * 修改计划更新回款计划表
     * @param payRegist
     * @param contractId
     */
    void resetPayPlan(List<PayRegist> payRegist, String contractId,String contractType);
    /**
     * 修改计划更新开票计划表
     * @param paymentRegist
     * @param contractId
     */
    void resetPaymentPlan(List<PaymentRegist> paymentRegist, String contractId, String contractType);
}
